package org.huang.user.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import org.huang.order.api.OrderService;
import org.huang.order.entity.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @描述：OrderTestController类描述
 * @作者: huanganwei
 * @创建时间: 2018-08-10 16:02:36
 * @版本: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderTestController {

    @Reference(version = "1.0.0",loadbalance ="roundrobin" )
    private OrderService orderService;

    @GetMapping("/{userId}")
    public List<Order> getOrder(@PathVariable Integer userId) throws ExecutionException, InterruptedException {
        return orderService.listByUserId(userId);
    }

}
